export default class Module {
  constructor(rawModule, path, parentModule) {
    this._raw = rawModule;
    this.state = rawModule.state;
    this._children = [];
    this.namespacedPath = parentModule
      ? parentModule.namespacedPath +
        (rawModule.namespaced
          ? `${parentModule.namespacedPath ? "/" : ""}${path[path.length - 1]}`
          : "")
      : "";
  }

  addChild(key, module) {
    this._children[key] = module;
  }

  getChild(key) {
    return this._children[key];
  }
}
